package com.testMvc.testAop1;

import com.core.springaop.MyCglibHandle;
import com.testMvc.GardenAction;
import org.aspectj.weaver.tools.PointcutExpression;
import org.aspectj.weaver.tools.PointcutParser;
import org.aspectj.weaver.tools.ShadowMatch;

import java.lang.reflect.Method;

public class testExpress {
    public static void main(String[] args) {
        test2();

    }

    private static void test1() {
        PointcutParser pp = PointcutParser
                .getPointcutParserSupportingAllPrimitivesAndUsingContextClassloaderForResolution();

        PointcutExpression pe = pp.parsePointcutExpression("execution(* com.testAll.testAop.*.spea*(..))");
        boolean isType = pe.couldMatchJoinPointsInType(GardenAction.class);

        Method[] ms = inter1Impl.class.getMethods();
        for (Method m : ms) {
            ShadowMatch sm = pe.matchesMethodExecution(m);
            System.out.println(m.getName() + ":" + sm.alwaysMatches());
        }
    }

    public static void test2() {

        Method[] ms = inter1Impl.class.getMethods();
        for (Method m : ms) {
            System.out.println(m.getName() + ":" + MyCglibHandle.ismatchExpress(m, "execution(* com.testAll.testAop.*.spea*(..))"));
        }
    }

}
